import javax.swing.JOptionPane;
public class Temperature {

	private int temp;
	private int high;
	private int low;
	
	public Temperature(){
		temp=0;
		high=0;
		low=1000;
		
	}
	
	
	
	//accessors
	public int getTemp(){
		return temp;
	}
	public int getHigh(){
		return high;
	}
	public int getLow(){
		return low;
	}
	
	//mutators
	public void setTemp(int aTemp) throws DangerouslyHighException, DangerouslyLowException{
		if(aTemp>300){
			throw new DangerouslyHighException();
		
		}
		else if(aTemp<200){
			throw new DangerouslyLowException();
		
		}
		if(aTemp>high){
			high=aTemp;
		}
		if(aTemp<low){
			low=aTemp;
		}
		 if(aTemp<=210){
			JOptionPane.showMessageDialog(null, "Warning. Temperature is nearing lower limit.");
			temp=aTemp;
			
		}
		else if(aTemp>=290){
			JOptionPane.showMessageDialog(null, "Warning. Temperature is nearing upper limit.");
			temp=aTemp;
		}
		else {
			JOptionPane.showMessageDialog(null, "Temperature is in acceptable range.");
			temp=aTemp;
		}
	}
}
